
import java.util.*;

public class Main{
	public static void main(String[] args){
		Comparator<String> comparator=new CustomComparator<String>();
		Set<String> set =new TreeSet<String>(comparator);
		//reverse input data

		set.add("ba");
		set.add("is");
		set.add("boo");
		set.add("man");

		set.add("ba");

		for(String name:set){
			System.out.print(name+" ");
		}	

		System.out.println();

	}
}